<?php
/**
 * 案内地図・周辺地図<br />
 *
 * @package apamanshop
 * @author　
 * @copyright　
 */
class Rstdtl_Model_Dspmap extends Apm_Model_Base {

	/**
	* 案内地図・周辺地図データ取得
	*/
	public function getDspMapData($params)
	{
		$db_params = array();
		$sql = $this->generateSql($params, $db_params);
		return $this->dbGetData($sql, $db_params);
	}

	private function generateSql($params, &$db_params)
	{
		// パラメータセット
		$db_params['roomCd'] = $params['room_cd'];
		
		// SQL
		$sql  = "";
		$sql .= "SELECT ";
		$sql .= "    * ";
		$sql .= "FROM ";
		$sql .= "    ( ";
		$sql .= "        SELECT ";
		$sql .= "             T03.* ";
		$sql .= "            ,TRUNC(MONTHS_BETWEEN(sysdate,";
		$sql .= "                                  TO_DATE(LPAD(TO_CHAR(NVL(T03_KANSEINEN, '00')), 4, '0') ";
		$sql .= "                                       || LPAD(TO_CHAR(NVL(T03_KANSEITSUKI, '00')), 2, '0') ";
		$sql .= "                                       || LPAD(TO_CHAR(NVL(T03_KANSEIBI, '01')), 2, '0'), 'yyyy.mm.dd')) / 12) AS TIKUNENSU ";
		$sql .= "            ,CASE ";
		$sql .= "                WHEN T03_SHIKIKIN_TSUKISUU IS NULL THEN T03_SHIKIKIN ";
		$sql .= "                ELSE TO_NUMBER(NVL(T03_SHIKIKIN_TSUKISUU,0)) * TO_NUMBER(NVL(T03_YACHIN,0)) ";
		$sql .= "                END AS T03_SHIKIKIN_COMP ";
		$sql .= "            ,CASE ";
		$sql .= "                WHEN T03_REIKIN_TSUKISUU IS NULL THEN T03_REIKIN ";
		$sql .= "                ELSE TO_NUMBER(NVL(T03_REIKIN_TSUKISUU,0)) * TO_NUMBER(NVL(T03_YACHIN,0)) ";
		$sql .= "                END AS T03_REIKIN_COMP ";
		$sql .= "            ,CASE ";
		$sql .= "                WHEN T03_HOSHOUKIN_TSUKISUU IS NULL THEN T03_HOSHOUKIN ";
		$sql .= "                ELSE TO_NUMBER(NVL(T03_HOSHOUKIN_TSUKISUU,0)) * TO_NUMBER(NVL(T03_YACHIN,0)) ";
		$sql .= "                END AS T03_HOSHOUKIN_COMP ";
		$sql .= "            ,CASE ";
		$sql .= "                WHEN T03_SHOUKYAKUKIN_TSUKISUU IS NULL THEN T03_SHOUKYAKUKIN ";
		$sql .= "                ELSE TO_NUMBER(NVL(T03_SHOUKYAKUKIN_TSUKISUU,0)) * TO_NUMBER(NVL(T03_YACHIN,0)) ";
		$sql .= "                END AS T03_SHOUKYAKUKIN_COMP ";
		$sql .= "            ,CASE ";
		$sql .= "                WHEN (( (sysdate-7) < T03_KOUSHINBI ) AND ( T03_KIGENGIRE_SHUUSEI_FLAG <> 1 )) THEN 0 ";
		$sql .= "                ELSE 1 ";
		$sql .= "                END AS SHINCHAKU_FLAG ";
		$sql .= "            ,DECODE( TRIM( NVL(T03_GAIKAN_GAZOU01, '') ), '', 1, 0 ) AS GAIKAN_UMU_FLAG ";
		$sql .= "            ,DECODE( TRIM( NVL(T03_MADORIZU, '') ), '', 1, 0 ) AS MADORI_UMU_FLAG ";
		$sql .= "            ,CASE ";
		$sql .= "                WHEN ( (TRIM(NVL(T03_NAISOU_GAZOU01, '')) IS NOT NULL) OR (TRIM(NVL(T03_NAISOU_GAZOU02, '')) IS NOT NULL) ) THEN 0 ";
		$sql .= "                ELSE 1 ";
		$sql .= "                END AS NAISOU_UMU_FLAG ";
		$sql .= "            ,DECODE( TRIM( NVL(T03_PANORAMA_GAZOU01, '') ), '', 1, 0 ) AS PANORAMA1_UMU_FLAG ";
		$sql .= "            ,DECODE( TRIM( NVL(T03_PANORAMA_GAZOU02, '') ), '', 1, 0 ) AS PANORAMA2_UMU_FLAG ";
		$sql .= "            ,M05.M05_TENPO_CD ";
		$sql .= "            ,M05.M05_TENPO_TEL01 ";
		$sql .= "            ,M05_JYUUSHO_TEXT ";
		$sql .= "            ,M05_TENPO_BANCHI ";
		$sql .= "            ,M05_TENPO_JYUUSHO_BIKOU ";
		$sql .= "            ,M05.M05_MAP ";
		$sql .= "            ,M05.M05_HOUZINMEI ";
		$sql .= "            ,M05.M05_MENKYO_HAKKOUMOTO ";
		$sql .= "            ,M05.M05_MENKYO_KOUSHINKAI ";
		$sql .= "            ,M05.M05_MENKYO_GOUSUU ";
		$sql .= "            ,SUBSTR(LPAD(TO_CHAR( TO_NUMBER(SUBSTR(M05_TENPO_CD,3,1)) + TO_NUMBER(SUBSTR(M05_TENPO_CD,4,1)) ";
		$sql .= "                + TO_NUMBER(SUBSTR(M05_TENPO_CD,5,1)) + TO_NUMBER(SUBSTR(M05_TENPO_CD,6,1)) + TO_NUMBER(SUBSTR(M05_TENPO_CD,7,1)) ";
		$sql .= "                + TO_NUMBER(SUBSTR(M05_TENPO_CD,8,1)) + TO_NUMBER(TO_CHAR(SYSDATE,'SS'))),3,'0'),3,1) AS RANDOM_INDEX ";
		$sql .= "            ,M01.M01_IDO/3600000 AS M01_IDO ";
		$sql .= "            ,M01.M01_KEIDO/3600000 AS M01_KEIDO ";
		$sql .= "        FROM ";
		$sql .= "             T03WEB_HEYA T03 ";
		$sql .= "            ,M05TENPO_INFO M05 ";
		$sql .= "            ,M01JYUUSHO M01 ";
		$sql .= "        WHERE ";
		$sql .= "                T03.T03_HEYA_CD = :roomCd ";
		$sql .= "            AND T03.T03_TENPO_CD = M05.M05_TENPO_CD ";
		$sql .= "            AND T03.T03_TODOUFUKEN_CD = M01.M01_TODOUFUKEN_CD ";
		$sql .= "            AND T03.T03_SHIKUCHOUSON_CD = M01.M01_SHIKUCHOUSON_CD ";
		$sql .= "            AND T03.T03_CHOUMEI_CD = M01.M01_CHOUMEI_CD ";
		$sql .= "            AND T03.T03_CHOUMOKU_CD = M01.M01_CHOUMOKU_CD ";
		$sql .= "    ) ";

		return $sql;
	}

	public function convertData($params, &$data)
	{
		// 地図デザイン
		$data['reqTbl'] = "A_STA2";
		// スケール設定
		$scl = $params['SCL'];
		if (!is_numeric($scl) || empty($scl))
		{
			$scl = 19;		// デフォルトスケール
		}
		else if ($scl > 200000)
		{
			$scl = 200000;
		}
		$data['scl'] = $scl;
		// 地図捜査
		$clk = $params['CLK'];
		if (empty($clk))
		{
			$clk = "2";		// デフォルト地図捜査
		}
		$data['clk'] = $clk;
		
		// 地図情報
		if (empty($params['room_cd']))
		{
			$data['reqX'] = $params['X'];
			$data['reqY'] = $params['Y'];
			$data['address'] = $params['address'];
			$data['banchi'] = $params['banchi'];
			$data['annai'] = "0";
			$data['error'] = 0;
		}
		else
		{
			if (empty($data['dspMap']))
			{
				// データがない場合エラー
				$data['error'] = 1;
			}
			else
			{
				// 物件データセット
				$data['reqY'] = $data['dspMap']['T03_IDO'];
				$data['reqX'] = $data['dspMap']['T03_KEIDO'];
				$data['reqY2'] = $data['dspMap']['M01_IDO'];
				$data['reqX2'] = $data['dspMap']['M01_KEIDO'];
				$data['address'] = $data['dspMap']['T03_JYUUSHO_TEXT'];
				$data['banchi'] = $data['dspMap']['T03_BANCHI'];
				$data['annai'] = $data['dspMap']['T03_ANNAI_MAP_USE_FLAG'];
				$data['koukoku'] = $data['dspMap']['T03_KOUKOKU_KAISHA_CD'];
				if ((is_null($data['reqY']) || is_null($data['reqX']))
					&& (is_null($data['reqY2']) || is_null($data['reqX2']))
					&& (is_null($data['address']) || is_null($data['banchi'])))
				{
					$data['error'] = 1;
				}
				else
				{
					$data['error'] = 0;
					$data['BKN_DATA'] = array();
					$data['BKN_DATA'] = $this->convertBknData($data['dspMap'], $data['annai']);
				}
			}
		}
		// サブタイトル
		if ($data['annai'] == "1")
		{
			$data['subTitle'] = "案内地図";
		}
		else
		{
			$data['subTitle'] = "周辺地図";
		}
		// テキスト
		$data['strH1']     = "賃貸住宅・賃貸マンション・賃貸アパートの検索ならアパマンショップ。全国の賃貸住宅、賃貸不動産情報が満載です。";
		$data['strSubTxt'] = "選択した物件の周辺の地図を表示しています。そのため、物件の正確な位置はアイコンでは表示されません。";
		
		// リクエストデータ
		$data['request'] = $params;
	}

	// 物件データを表示用に加工
	private function convertBknData($data, $annai)
	{
		$bknData = array();
		// 住所
		$bknData['T03_JYUUSHO_TEXT'] = Apm_Bukkenitems::GetAddressStr($data, $annai);
		// GetAddressStrで番地判断するため不要
		//if ($annai == "1")
		//{
		//	if ($data['T03_BANCHI'] != "")
		//	{
		//		$bknData['T03_BANCHI'] = $data['T03_BANCHI'];
		//	}
		//	else
		//	{
		//		$bknData['T03_BANCHI'] = "－";
		//	}
		//}
		//else
		//{
		//	$bknData['T03_BANCHI'] = "";
		//}
		// 沿線
		$bknData['RAIL_STR'] = Apm_Bukkenitems::GetRailStr($data);
		// 駅
		$bknData['STATION_STR'] = Apm_Bukkenitems::GetStationStr($data);
		// バス徒歩
		$bknData['BUS_TOHO'] = Apm_Bukkenitems::GetBusToho($data);
		// 賃料
		$bknData['CHINRYO'] = Apm_Bukkenitems::GetChinryouStr($data);
		// 平米単価
		$bknData["HEIBEI_TANKA"] = Apm_Bukkenitems::GetHeibeiTankaStr($data,true);
		// 共益費・管理費
		$bknData['KYOUEKI'] = Apm_Bukkenitems::GetKyouekihiStr($data, 1);
		// 敷金
		$bknData['SIKIKIN'] = Apm_Bukkenitems::GetShikikinStr($data);
		// 礼金
		$bknData['REIKIN'] = Apm_Bukkenitems::GetReikinStr($data);
		// 保証金
		$bknData['HOSYOKIN'] = Apm_Bukkenitems::GetHoshoukinStr($data);
		// 敷引償却金
		$bknData['SYOKYAKUKIN'] = Apm_Bukkenitems::GetShoukyakukinStr($data);
		// 間取り
		$bknData['T03_MADORI'] = Apm_Bukkenitems::GetMadoriStr($data);
		// 占有面積
		$bknData['SENYU_M2'] = Apm_Bukkenitems::GetSenyuuMensekiStr($data);
		// 築年数
		if($data["TIKUNENSU"] == 0){
			$bknData["TIKUNENSU"] = "－";
		}else{
			$bknData["TIKUNENSU"] = $data["TIKUNENSU"]."年";
		}
		// 築年月
		$bknData['BUILD_YM'] = Apm_Bukkenitems::GetBuildYmStr($data);
		// 物件番号
		//$bknData['T03_ORIGINAL_HEYA_CD01'] = Apm_Bukkenitems::GetInquiryNoStr($data);
		// 交通機関タグ
		//$bknData['TRAFFIC_STATION'] = $this->getTrafficTagStation($data);
		//$bknData['TRAFFIC_BUS'] = $this->getTrafficTagBus($data);
		//$bknData['TRAFFIC_TOHO'] = $this->getTrafficTagToho($data);
		// 構造種別
		//$bknData['T03_TATEMONO_KOUZOU'] = Apm_Bukkenitems::GetBuildStrctStr($data);
		// 建物種別
		//$bknData['T03_TATEMONO_TYPE'] = Apm_Bukkenitems::GetBuildTypeStr($data);
		// 総戸数
		//$bknData['ROOM_CNT'] = Apm_Bukkenitems::GetBuildRoomNumStr($data);
		// 間取詳細
		//$bknData['MADORI_DTL'] = Apm_Bukkenitems::GetMadoriShousaiStr($data);
		// 階建
		if ($data['T03_KAIDATE'] > 0) {
			$bknData['KAIDATE'] = $data['T03_KAIDATE']."階建";
		} else {
			$bknData['KAIDATE'] = "－";
		}
		//階
		if ($data['T03_KAI'] > 0) {
			$bknData['KAI'] = $data['T03_KAI']."階";
		} else {
			$bknData['KAI'] = "－";
		}
		
		
		
		
//2011/01/26 Bukkenitemsを呼ぶように修正
/*
		// めやす賃料
		if ($data['T03_MEYASU_CHINRYO'] > 0) {
			$bknData['T03_MEYASU_CHINRYO'] = $data['T03_MEYASU_CHINRYO'];
		} else {
			$bknData['T03_MEYASU_CHINRYO'] = "";
		}
		// 初期費用
		if ($data['T03_TEN_SHOKI_HIYO'] > 0) {
			$bknData['T03_TEN_SHOKI_HIYO'] = $data['T03_TEN_SHOKI_HIYO']."万円";
		} else {
			$bknData['T03_TEN_SHOKI_HIYO'] = "－";
		}
*/		
		// めやす賃料 
		$bknData['T03_MEYASU_CHINRYO'] = Apm_Bukkenitems::GetMeyashuTinryoStr($data,true,true);
		// 初期費用
		$bknData['T03_TEN_SHOKI_HIYO'] = Apm_Bukkenitems::GetSyokiHiyouStr($data,true);
		
		// 部屋向き
		//$bknData['HEYAMUKI'] = Apm_Bukkenitems::GetHeyamukiStr($data);
		// 駐車場
		//$bknData['PARKING'] = Apm_Bukkenitems::GetParkingStr($data);
		// 保険
		//$bknData['HOKEN'] = Apm_Bukkenitems::GetHokenStr($data);
		// 入居可能時期
		//$bknData['NYUKYO_ZIKI'] = Apm_Bukkenitems::GetNyuukyoZikiStr($data);
		// 入居条件
		//$bknData['NYUKYO_JOKEN'] = Apm_Bukkenitems::GetNyuukyoJyoukenStr($data);
		// 設備
		//$bknData['SETUBI'] = Apm_Bukkenitems::GetSetsubiStr($data);
		// その他
		//$bknData['SONOTA'] = Apm_Bukkenitems::GetSonotaInfoStr($data);
		
		// 画像取得
		/*
		$imageL = "";
		$imageS = "";
		$imgKind = "";
		// 間取り図
		//Apm_Bukkenitems::ChkBukkenImage($data, 4, $imageL, $imageS, $imgKind);
		$bknData['IMG_MADORI_L'] = $imageL;
		// 外観
		//Apm_Bukkenitems::ChkBukkenImage($data, 1, $imageL, $imageS, $imgKind);
		$bknData['IMG_GAIKAN_L'] = $imageL;
		*/
		
		// 店舗名
		//$bknData['SHOP_NM'] = Apm_Bukkenitems::GetShopNm($data);
		// 会社名
		//$bknData['M05_HOUZINMEI'] = $data['M05_HOUZINMEI'];
		// 宅建免許
		//$bknData['M05_MENKYO_HAKKOUMOTO'] = $data['M05_MENKYO_HAKKOUMOTO'];
		//$bknData['M05_MENKYO_KOUSHINKAI'] = $data['M05_MENKYO_KOUSHINKAI'];
		//$bknData['M05_MENKYO_GOUSUU']     = $data['M05_MENKYO_GOUSUU'];
		// 取引態様
		//$bknData['TORIHIKI_TAIYO'] = Apm_Bukkenitems::GetTorihikiTaiyouStr($data);
		// TEL
		//$bknData['SHOP_TEL'] = Apm_Bukkenitems::GetShopTel($data);
		// Address
		//$bknData['SHOP_ADDRESS'] = Apm_Bukkenitems::GetShopAddress($data);
		
		return $bknData;
	}

	// 案内地図の利用カウント機能
	public function setMapUseCount($params)
	{
		// 案内地図利用回数を取得
		$result = array();
		$sql = $this->generateUseCountSql();
		$result = $this->dbGetData($sql, array());
		
		$gCount   = 0;
		$gKosinbi = "";
		$today  = getdate();
		$gToday = intval($today['year'] . sprintf("%02d", $today['mon']) . sprintf("%02d", $today['mday']));
		if (!empty($result))
		{
			$gCount = $result['T05_NUMBER'];
			$gKosinbi = intval($result['T05_NUMBERED_DATE']);
		}
		
		// 更新日が前日以前の場合、カウントを０に更新する
		if ($gKosinbi < $gToday)
		{
			$gCount = 0;
		}
		// シリアルNOのアップデート
		$sql = $this->generateUpdCountSql($gCount);
		$db = $this->getDbConnection();
		$this->startTransaction($db);
		try {
			$this->dbExecQuery($sql, array(), $db);
			$this->commitTransaction($db);
		} catch (Exception $e) {
			$this->rollbackTransaction($db);
			__log_debug(__FILE__, __LINE__, __METHOD__, $e->getMessage());
		}
		$db->closeConnection();
		
		return $gCount;
	}

	// 案内地図利用回数取得SQL
	private function generateUseCountSql()
	{
		$sql  = "";
		$sql .= "SELECT ";
		$sql .= "     T05.T05_NUMBER ";
		$sql .= "    ,TO_CHAR(T05.T05_NUMBERED_DATE, 'YYYYMMDD') AS T05_NUMBERED_DATE ";
		$sql .= "FROM ";
		$sql .= "     T05SERIAL_NUMBER T05 ";
		$sql .= "WHERE ";
		$sql .= "        T05.T05_OBJECT_KEY = 'googleMap' ";
		
		return $sql;
	}

	// シリアルNOのアップデートSQL
	private function generateUpdCountSql($gCount)
	{
		$sql  = "";
		$sql .= "UPDATE ";
		$sql .= "     T05SERIAL_NUMBER ";
		$sql .= "SET ";
		$sql .= "     T05_NUMBERED_DATE = SYSDATE ";
		$sql .= "    ,T05_NUMBER = " . $gCount . "+1 ";
		$sql .= "WHERE ";
		$sql .= "        T05_OBJECT_KEY = 'googleMap' ";
		
		return $sql;
	}

	/**
	 *  中心地の住所を取得
	 */
	public function getRequestCenter($params)
	{
		$db_params = array();
		$sql = $this->generateRequestCenterSql($params, $db_params);
		return $this->dbGetData($sql, $db_params);
		//return $this->dbGetData($sql, array());
	}

	private function generateRequestCenterSql($params, &$db_params)
	{
		$LngLat = $this->Fv_WTJ($params['ido'], $params['keido']);
		$db_params['lnglat1'] = $LngLat[0];
		$db_params['lnglat2'] = $LngLat[1];
		
		$sql  = " SELECT ";
		$sql .= "     M01_TODOUFUKEN ";
		$sql .= "    ,M01_SHIKUCHOUSON ";
		$sql .= "    ,M01_CHOUMEI ";
		$sql .= "    ,M01_CHOUMOKU ";
		$sql .= " FROM ";
		$sql .= "     M01JYUUSHO_LOCATION ";
		$sql .= " WHERE ";
		$sql .= "     M01_JYUUSHO_CD = ( ";
		$sql .= "         SELECT ";
		$sql .= "             M01_JYUUSHO_CD ";
		$sql .= "         FROM ";
		$sql .= "             M01JYUUSHO_LOCATION ";
		$sql .= "         WHERE ";
		//$sql .= "             M01_JYUUSHO_CD = '01101079000' ";
		$sql .= "             MDSYS.SDO_NN ( ";
		$sql .= "                 M01_LOCATION ";
		$sql .= "               , MDSYS.SDO_GEOMETRY( 2001, 8301, MDSYS.sdo_point_type( :lnglat1 , :lnglat2 ,NULL ) ,NULL ,NULL ) ";
		$sql .= "               , 'querytype=WINDOW' ";
		$sql .= "             ) = 'TRUE' ";
		/*
		*/
		$sql .= "     ) ";
		
		return $sql;
	}

	public function convertRequestCenter($data)
	{
		//$html = "";
		//$br = "\r\n";
		$api_data = array();
		
		if (!empty($data['XML_DATA']))
		{
			$rec = $data['XML_DATA'];
			
			/*
			$html .= "<?xml version=\"1.0\" encoding=\"Shift_JIS\" standalone=\"yes\"?>" . $br;
			$html .= "<POST_DATA>" . $br;
			$html .= "<address>" . $rec['M01_TODOUFUKEN'] . "</address>" . $br;
			$html .= "<address>" . $rec['M01_SHIKUCHOUSON'] . "</address>" . $br;
			if (empty($rec['M01_CHOUMEI'])) {
				$html .= "<address>no</address>" . $br;
			}
			else {
				$html .= "<address>" . $rec['M01_CHOUMEI'] . "</address>" . $br;
			}
			if (empty($rec['M01_CHOUMOKU'])) {
				$html .= "<address>no</address>" . $br;
			}
			else{
				$html .= "<address>" . $rec['M01_CHOUMOKU'] . "</address>" . $br;
			}
			$html .= "</POST_DATA>" . $br;
			*/
			
			$api_data['POST_DATA'][] = array();
			$api_data['POST_DATA']['TODOUFUKEN']   = $rec['M01_TODOUFUKEN'];
			$api_data['POST_DATA']['SHIKUCHOUSON'] = $rec['M01_SHIKUCHOUSON'];
			$api_data['POST_DATA']['CHOUMEI']      = $rec['M01_CHOUMEI'];
			$api_data['POST_DATA']['CHOUMOKU']     = $rec['M01_CHOUMOKU'];
			
		}
		//echo $html;
		
		return $api_data;
	}

	// 世界測地→日本測地
	public function Fv_WTJ($ido, $keido)
	{
		$LngLat = array();
		$LngLat[0] = $keido + $ido * 0.000046047 + $keido * 0.000083049 - 0.010041;
		$LngLat[1] = $ido + $ido * 0.00010696 - $keido * 0.000017467 - 0.0046020;
		return $LngLat;
	}

	// 交通機関タグ：沿線・駅
	private function getTrafficTagStation($data)
	{
		$ret = "";
		$ensen = $data['T03_ENSEN_NAME'];
		$eki   = $data['T03_EKI_NAME'];
		
		// 駅名が存在する場合
		if (!empty($eki) && $eki != "＊＊＊" && $eki != "＊＊＊＊")
		{
			$ret .= $ensen . "/" . $eki;
		}
		
		return $ret;
	}

	// 交通機関タグ：バス
	private function getTrafficTagBus($data)
	{
		$ret = "";
		$ensenCd = $data['T03_ENSEN_CD01'];
		$ensen   = $data['T03_ENSEN_NAME'];
		$eki     = $data['T03_EKI_NAME'];
		$busStop = $data['T03_BUS_STOP'];
		$busTime = $data['T03_BUS_JYOUSHA'];
		
		// 駅名が存在かつ乗車時間＞０の場合
		if (!empty($eki) && $eki != "＊＊＊" && $eki != "＊＊＊＊" && intval($busTime) > 0)
		{
			$ret .= "バス" . $busTime . "分";
			// バス停名が存在する場合
			if (!empty($busStop))
			{
				$ret .= "/" . $busStop;
			}
		}
		// 沿線がバスの場合
		else if ($ensenCd == "3500" || $ensenCd == "3501" || $ensenCd == "3502" || $ensenCd == "3503"
				|| $ensenCd == "3504" || $ensenCd == "3505" || $ensenCd == "3506" || $ensenCd == "3507"
				|| $ensenCd == "3508" || $ensenCd == "3509" || $ensenCd == "3510" || $ensenCd == "3511")
		{
			$ret .= $ensen . "/" . $busStop;
		}
		
		return $ret;
	}

	// 交通機関タグ：徒歩時間
	private function getTrafficTagToho($data)
	{
		$ret = "";
		$ensenCd = $data['T03_ENSEN_CD01'];
		$ensen   = $data['T03_ENSEN_NAME'];
		$eki     = $data['T03_EKI_NAME'];
		$busStop = $data['T03_BUS_STOP'];
		$busTime = $data['T03_BUS_JYOUSHA'];
		$toho    = $data['T03_TOHO01'];
		
		// 駅名が存在かつ徒歩時間＞０場合
		if (!empty($eki) && $eki != "＊＊＊" && $eki != "＊＊＊＊" && intval($toho) > 0)
		{
			// バス時間が存在する場合
			if (intval($busTime) > 0)
			{
				$ret .= "停歩";
			}
			else
			{
				$ret .= "徒歩";
			}
			$ret .= "&nbsp;" . $toho . "分";
		}
		// 沿線がバスの場合
		else if ($ensenCd == "3500" || $ensenCd == "3501" || $ensenCd == "3502" || $ensenCd == "3503"
				|| $ensenCd == "3504" || $ensenCd == "3505" || $ensenCd == "3506" || $ensenCd == "3507"
				|| $ensenCd == "3508" || $ensenCd == "3509" || $ensenCd == "3510" || $ensenCd == "3511")
		{
			$ret .= "徒歩&nbsp;" . $toho . "分";
		}
		
		return $ret;
	}

}